﻿using System.Collections.Generic;

namespace battlenet.wow.rt.domain.objects
{
    public enum AuctionLengthType
    {
        VeryLong,
        Long,
        Medium,
        Short,
        VeryShort
    }

    public class AuctionLengthTypeConverter
    {
        public static AuctionLengthType GetType(string input)
        {
            input = input.ToUpper();
            AuctionLengthType type;
            switch (input)
            {
                case "VERY_LONG":
                    type = AuctionLengthType.VeryLong;
                    break;
                case "LONG":
                    type = AuctionLengthType.Long;
                    break;
                case "MEDIUM":
                    type = AuctionLengthType.Medium;
                    break;
                case "SHORT":
                    type = AuctionLengthType.Short;
                    break;
                case "VERY_SHORT":
                    type = AuctionLengthType.VeryShort;
                    break;
                default:
                    throw new KeyNotFoundException(string.Format("\"{0}\" is not a recognized auction length type", input));
            }

            return type;
        }
    }
}
